package work20241203_chap6oop.f_demo4;

/**
 * @author zdl
 * @date 2024/12/3
 */
class Super{
    public void m(){
        System.out.println("m() in Super");
    } }
class Sub extends Super{
    public void m(){
        System.out.println("m() in Sub");
    } }
public class TestSuperSub{
    public static void foo(Super s){
        s.m();
    }
    public static void main(String args[]){
        Sub sub = new Sub();
        Super sup = new Super();
        foo(sup);//m() in Super
        foo(sub);//m() in Sub
    } }
